<?php
/*
 * 反馈验证
*/
namespace App\Validation;

use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\Numericality;

class FeedbackValidation extends BaseValidation
{
    public function initialize()
    {

		$this->add(
			"content",
			new PresenceOf(
				  [
					  "message" => "The content is required",
				  ]
			)
		);
		
		$this->add(
			"contact",
			new PresenceOf(
				  [
					  "message" => "The contact is required",
				  ]
			)
		);

		$this->add(
			"type_id",
			new Numericality(
				  [
					  "message" => ":field is not numeric",
					  "allowEmpty" => true,
				  ]
			)
		);

    }
	
	//验证之前
	public function beforeValidation($data, $entity, $messages)
    {
        return true;
    }
	
}